Skip to content

AArch64: make sure SP is 16-aligned at all times during Pallocframe - #617

Open
xavierleroy wants to merge 1 commit into
masterfrom
aarch64-frame-alignment
Open

xavierleroy wants to merge 1 commit into
masterfrom
aarch64-frame-alignment

Conversation

@xavierleroy

Copy link
Copy Markdown
Contributor

SP-relative accesses crash if SP mod 16 != 0. This could happen before when setting up the stack frame, in the case where the outgoing arguments area of the frame has size = 8 mod 16. Then, the store of the return address and the back link would take place with SP = 8 mod 16 and crash, before SP is further decreased to a multiple of 16.

This commit avoids this problem by aligning the size of the outgoing arguments area to 16.

Fixes: #614
Closes: #615

SP-relative accesses crash if SP mod 16 != 0.  This could happen before
when setting up the stack frame, in the case where the outgoing arguments area
of the frame has size = 8 mod 16.  Then, the store of the return address
and the back link would take place with SP = 8 mod 16 and crash, before
SP is further decreased to a multiple of 16.

This commit avoids this problem by aligning the size of the outgoing arguments
area to 16.

Fixes: #614
Closes: #615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aarch64 (macOS): misaligned SP in the prologue of a function with a frame > 512 bytes that passes 1–8 bytes of stack arguments → SIGBUS

1 participant